package com.hsylient.spring.entity;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.io.Serializable;

/**
 * 用于测试单例对象的类
 */
@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public class Person implements Serializable {

    @PostConstruct
    public void init() {
        System.out.println("构造方法执行之后执行");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("对象被销毁。。。");
    }
}
